﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EQual.MainModule.Employees.DetailsViews
{
    public class  EmployeeDistributionPresenter : EQual .Infrastructure .MVPFramework .Presenters .ListPresenterDefault  <EQual .MainModule .Documents .Views .IDocumentGridView  ,DataAccesLayer .Employee >
    {
        DataAccesLayer.EQualDataLayerFactory  datalayer;

        public EmployeeDistributionPresenter()
        {
            datalayer = new DataAccesLayer.EQualDataLayerFactory() ;

            InitializeViews();

            View.ItemAdded += new EventHandler<Microsoft.Practices.Composite.Events.DataEventArgs<DataAccesLayer.Document >>(View_ItemAdded);
            View.IsEditable = false;
        }

        protected virtual void InitializeViews()
        {
            View = new EQual.MainModule.Documents.Views.DocumentsGridViewControl();
            View.IsEditable = false;
        }
        
        void View_ItemAdded(object sender, Microsoft.Practices.Composite.Events.DataEventArgs<DataAccesLayer.Document> e)
        {
             
        }

        public override void Dispaly(DataAccesLayer.Employee  item)
        {       
            View.Model = new
            {
                ItemsCollection = datalayer.GetDocumentAccesLayer().GetDocumentsEmployeeNotified(item.id.ToString())
            };
            
        }

    }
}
